
#pragma once

#include <string>

//#include <QMainWindow>
#include "ribbonwindow.h"
#include <osg/vec4>
#include <osg/ref_ptr>

QT_BEGIN_NAMESPACE
class QAction;
class QListWidget;
class QMenu;
class QTextEdit;
class QTranslator;
class QFileSystemWatcher;
class QStackedWidget;
class QUndoStack;
class QDockWidget;
class QSplitter;
class QUndoStack;
QT_END_NAMESPACE

class ViewerExt;
class PickHandler;
class DoubleJsonFile;
class CmdLineCtrl;
class QtOSGWidget;
class Scene;

class MainWindow : public RibbonWindow
{
	Q_OBJECT

public:
	MainWindow();
	~MainWindow();
	osg::Vec4 getCurrentColor();
	void openRecentFile(const QString &);
	using base = RibbonWindow;

signals:
	void updateRecentFileActions(const QStringList &files);
	void configChanged();

protected:
	void retranslate();
	virtual void changeEvent(QEvent *event) override;
	virtual void closeEvent(QCloseEvent *event) override;

private:
	void showHelpDocument();
	template<typename DlgType>
	void showDlg();
	void create3DWidget();
	void setLanguage(QAction *sender);
	void updateCommands();
	void onUndoStackIndexChanged(int index);
	void undo();
	void redo();

	bool newFileInner();
	bool newFile();
	bool openFile();
	bool closeFile();
	bool saveFile(bool saveAs);
	bool saveAsFile();
	bool innerOpenFile(const QString &);
	void setCurrentFile(const QString &fileName);
	void removeFileFromRecentList(const QString &fileName);
	void writeSettings();
	void setScene(Scene* oldScene, Scene* newScene);
	void setCurrentColor();
	void importCurve2d();
	void importModel();
	void exportOSG();
	void exportBrep();
	void setUCSMask();
	void setUCSMeshMask();
	void showAllFace();

	QSplitter* m_3dSplitter;
	QtOSGWidget* m_widget3D;
	QUndoStack* m_undoStack;

	QString m_fileName;
	QStringList m_recentFiles;

	std::vector<std::string> m_loadedTextures;

	QColor m_color = Qt::black;
};
